home *** CD-ROM | disk | FTP | other *** search
/ Teach Your Children: Road Construction Ahead / Teach Your Children: Road Construction Ahead.iso / mac / Road Construction Ahead / Road Construction Ahead / 00024_Rotator Class.ls < prev    next >
Encoding:
Text File  |  1996-07-17  |  1.8 KB  |  92 lines

  1. property Xpos, xSteps, Ypos, ySteps, channel, multiplier, rotatorMovie
  2. global gCustomCursor, gRollAnimButton, g3DObject
  3.  
  4. on birth me
  5.   set channel to 2
  6.   set Xpos to 0
  7.   set xSteps to 23
  8.   set Ypos to 0
  9.   set ySteps to 13
  10.   set multiplier to 2
  11.   return me
  12. end
  13.  
  14. on setup me
  15.   puppetSprite(channel, 1)
  16.   set the castNum of sprite channel to the number of cast rotatorMovie
  17.   set the locH of sprite channel to 331
  18.   set Xpos to 0
  19.   set Ypos to 10
  20.   paletteFix()
  21.   set the visible of sprite channel to 0
  22.   go(the frame + 1)
  23.   set the movieTime of sprite channel to 230
  24.   set the visible of sprite channel to 1
  25. end
  26.  
  27. on arrowButton me
  28.   startBuffering()
  29.   if not objectp(gRollAnimButton) then
  30.     if objectp(gCustomCursor) then
  31.       resetTool(g3DObject)
  32.       flushBuffer()
  33.       exit
  34.     else
  35.       set handlerName to the name of cast the castNum of sprite the clickOn
  36.       if char length(handlerName) of handlerName <> "+" then
  37.         set commandString to handlerName & "( gRotatorObject )"
  38.         birth(script "Repeating Button Class", commandString, 6)
  39.       end if
  40.     end if
  41.   end if
  42. end
  43.  
  44. on left me
  45.   set Xpos to Xpos - multiplier
  46.   if Xpos < 0 then
  47.     set Xpos to (xSteps * multiplier) - multiplier
  48.   end if
  49.   changeView(me)
  50.   return 1
  51. end
  52.  
  53. on right me
  54.   set Xpos to Xpos + multiplier
  55.   if Xpos = (xSteps * multiplier) then
  56.     set Xpos to 0
  57.   end if
  58.   changeView(me)
  59.   return 1
  60. end
  61.  
  62. on down me
  63.   if Ypos > 0 then
  64.     set Ypos to Ypos - multiplier
  65.     changeView(me)
  66.     return 1
  67.   else
  68.     return 0
  69.   end if
  70. end
  71.  
  72. on Up me
  73.   if Ypos < ((ySteps * multiplier) - multiplier) then
  74.     set Ypos to Ypos + multiplier
  75.     changeView(me)
  76.     return 1
  77.   else
  78.     return 0
  79.   end if
  80. end
  81.  
  82. on changeView me
  83.   set offset to Xpos + (Ypos * xSteps)
  84.   set the movieTime of sprite channel to offset
  85. end
  86.  
  87. on prepareToLeave me
  88.   set Xpos to 0
  89.   set Ypos to 0
  90.   puppetSprite(channel, 0)
  91. end
  92.